<template>
  <div>
    <el-form ref="form" label-width="180px">
      <el-form-item label="手术时间">
        <el-date-picker
          v-model="form.thymicSurgeryTime"
          type="date"
          placeholder="选择日期"
        />
      </el-form-item>
      <el-form-item label="与首发症状的时间间隔">
        <el-input v-model="form.timeInterval" />
      </el-form-item>
      <el-form-item label="术前肌无力危象">
        <el-radio-group v-model="form.crisis" @change="handleCrisis">
          <el-radio :label="1">有</el-radio>
          <el-radio :label="2">无</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item v-show="form.crisis === 1" label="危象次数">
        <el-input v-model="form.crisisTimes" />
      </el-form-item>
      <el-form-item label="术前MGFA分型（术前1周）">
        <el-select v-model="form.mgfa" placeholder="请选择">
          <el-option label="I 型" value="1" />
          <el-option label="II A型" value="2" />
          <el-option label="II B型" value="3" />
          <el-option label="III A型" value="4" />
          <el-option label="III B型" value="5" />
          <el-option label="IV A型" value="6" />
          <el-option label="IV B型" value="7" />
          <el-option label="V 型" value="8" />
        </el-select>
      </el-form-item>
      <el-form-item label="有无球部肌肉受累">
        <el-radio-group v-model="form.sphericalMuscle">
          <el-radio :label="1">有</el-radio>
          <el-radio :label="2">无</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="术前用药（1月内）">
        <el-radio-group v-model="form.preoperativeMedication" @change="handlePreoperativeMedication">
          <el-radio :label="1">有</el-radio>
          <el-radio :label="2">无</el-radio>
        </el-radio-group>
      </el-form-item>
      <div v-show="form.preoperativeMedication === 1">
        <el-form-item label="用药种类">
          <el-select v-model="form.medicationType" placeholder="请选择">
            <el-option label="溴吡斯的明" value="1" />
            <el-option label="醋酸泼尼松" value="2" />
            <el-option label="美卓乐" value="3" />
            <el-option label="硫唑嘌呤" value="4" />
            <el-option label="他克莫司" value="5" />
            <el-option label="环孢素A" value="6" />
            <el-option label="吗替麦考酚酯" value="7" />
            <el-option label="甲氨蝶呤" value="8" />
            <el-option label="环磷酰胺" value="9" />
            <el-option label="利妥昔单抗" value="10" />
          </el-select>
        </el-form-item>
        <el-form-item label="溴吡斯的明日剂量">
          <el-input v-model="form.dose" />
        </el-form-item>
        <el-form-item label="溴吡斯的明术前使用时间">
          <el-date-picker
            v-model="form.preoperativeUseTime"
            type="date"
            placeholder="选择日期"
          />
        </el-form-item>
        <el-form-item label="免疫抑制剂:">
          <el-checkbox-group v-model="form.immunosuppressive" @change="handleImmunosuppressive">
            <el-checkbox label="1" name="immunosuppressive">利妥昔单抗</el-checkbox>
            <el-checkbox label="2" name="immunosuppressive">醋酸泼尼松</el-checkbox>
            <el-checkbox label="3" name="immunosuppressive">甲泼尼龙</el-checkbox>
            <el-checkbox label="4" name="immunosuppressive">硫唑嘌呤</el-checkbox>
            <el-checkbox label="5" name="immunosuppressive">他克莫司</el-checkbox>
            <el-checkbox label="6" name="immunosuppressive">环孢素A</el-checkbox>
            <el-checkbox label="7" name="immunosuppressive">吗替麦考酚酯</el-checkbox>
            <el-checkbox label="8" name="immunosuppressive">甲氨蝶呤</el-checkbox>
            <el-checkbox label="9" name="immunosuppressive">环磷酰胺</el-checkbox>
          </el-checkbox-group>
        </el-form-item>
        <immunosuppressive-detail
          v-for="item in titles"
          :key="item.id"
          :ref="'immunosuppressive'+item.id"
          :title="item.title"
          :show="isShow(item.id)"
        />
      </div>
      <el-form-item label="术前丙球冲击（1月内）">
        <el-radio-group v-model="form.bingQiu">
          <el-radio :label="1">有</el-radio>
          <el-radio :label="2">无</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="术前激素冲击（1月内）">
        <el-radio-group v-model="form.hormone">
          <el-radio :label="1">有</el-radio>
          <el-radio :label="2">无</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="术前血浆置换（1月内）">
        <el-radio-group v-model="form.plasma">
          <el-radio :label="1">有</el-radio>
          <el-radio :label="2">无</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="术前肺功">
        <el-radio-group v-model="form.feiGong" @change="handleFeiGong">
          <el-radio :label="1">已做</el-radio>
          <el-radio :label="2">未做</el-radio>
        </el-radio-group>
      </el-form-item>
      <div v-show="form.feiGong === 1">
        <el-form-item label="FVC">
          <el-input v-model="form.fcv" />
        </el-form-item>
        <el-form-item label="FEV1">
          <el-input v-model="form.fev1" />
        </el-form-item>
        <!-- <el-form-item label="FEV1/FVC">
          <el-input v-model="form.glycopathyDose" />
        </el-form-item> -->
        <el-form-item label="术前肌无力症状">
          <el-radio-group v-model="form.muscleWeakness" @change="handleMuscleWeakness">
            <el-radio :label="1">无</el-radio>
            <el-radio :label="2">有</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item v-show="muscleWeaknessValue === 1" label="患者主诉">
          <el-input v-model="form.glycopathyDose" />
        </el-form-item>
      </div>
      <el-form-item label="手术方式">
        <el-radio-group v-model="form.surgicalApproach" @change="handleSurgicalApproach">
          <el-radio :label="1">经胸骨正中</el-radio>
          <el-radio :label="2">经颈部胸腺切除</el-radio>
          <el-radio :label="3">经颈胸联合胸腺切除</el-radio>
          <el-radio :label="4">胸腔镜</el-radio>
          <el-radio :label="5">机器人</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item v-show="surgicalApproachValue === 4" label="剑突下肋缘三孔手术切除">
        <el-radio-group v-model="form.surgery">
          <el-radio :label="1">是</el-radio>
          <el-radio :label="2">否</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="切除范围">
        <el-radio-group v-model="form.scope">
          <el-radio :label="1">单纯胸腺切除</el-radio>
          <el-radio :label="2">扩大胸腺切除（肿瘤切除+脂肪清扫）</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="手术时长">
        <el-input v-model="form.surgicalDuration" />
      </el-form-item>
      <el-form-item label="术中失血量（ml）">
        <el-input v-model="form.loseWeight" />
      </el-form-item>
      <el-form-item label="术后肌无力危象">
        <el-radio-group v-model="form.muscleWeaknessAfter">
          <el-radio :label="1">有</el-radio>
          <el-radio :label="2">无</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="术后并发症">
        <el-select v-model="form.complication" placeholder="请选择">
          <el-option label="肺部感染" value="1" />
          <el-option label="胸腔积液" value="2" />
          <el-option label="下肢静脉血栓" value="3" />
          <el-option label="肺栓塞" value="4" />
          <el-option label="纵膈炎" value="5" />
          <el-option label="声带麻痹" value="6" />
        </el-select>
      </el-form-item>
      <el-form-item label="术后病理">
        <el-select v-model="form.pathology" placeholder="请选择" @change="handlePathology">
          <el-option label="正常胸腺" value="1" />
          <el-option label="胸腺增生" value="2" />
          <el-option label="胸腺瘤" value="3" />
          <el-option label="胸腺囊肿" value="4" />
          <el-option label="脂肪瘤" value="5" />
          <el-option label="胸腺萎缩" value="6" />
          <el-option label="未退化胸腺" value="7" />
          <el-option label="其他" value="8" />
        </el-select>
      </el-form-item>
      <div v-show="pathologyValue === '3'">
        <el-form-item label="术中MOSAOKA分期">
          <el-select v-model="form.pathology" placeholder="请选择">
            <el-option label="I 期" value="1" />
            <el-option label="II a期" value="2" />
            <el-option label="II b期" value="3" />
            <el-option label="III a期" value="4" />
            <el-option label="III b期" value="5" />
            <el-option label="IV a期" value="6" />
            <el-option label="IV b期" value="7" />
          </el-select>
        </el-form-item>
        <el-form-item label="查看胸腺瘤MASAOKA临床分期对照表:">
          <el-checkbox-group v-model="form.name" @change="handleCheckBox">
            <el-checkbox label="1" name="name">查看</el-checkbox>
          </el-checkbox-group>
        </el-form-item>
        <div v-show="checkBoxValue.indexOf('1') !== -1" class="text-wrapper">
          Ⅰ  期：局限于包膜内
          Ⅱa 期：镜下浸润包膜
          Ⅱb 期：侵犯或大块紧邻周围脂肪组织，但未穿透纵膈胸膜或心包膜
          Ⅲa 期：肿瘤侵犯邻近组织或器官，包括心包、肺，未侵犯大血管
          Ⅲb 期：肿瘤侵犯邻近组织或器官，包括心包、肺，侵犯大血管
          Ⅳa期：肿瘤广泛侵犯胸膜和（或）心包
          Ⅳb期：肿瘤扩散到远处器官
        </div>
        <el-form-item label="胸腺瘤病理">
          <el-select v-model="form.pathology" placeholder="请选择">
            <el-option label="A" value="1" />
            <el-option label="AB" value="2" />
            <el-option label="B1" value="3" />
            <el-option label="B2" value="4" />
            <el-option label="B3" value="5" />
            <el-option label="C" value="6" />
          </el-select>
        </el-form-item>
      </div>
    </el-form>
  </div>
</template>

<script>
import immunosuppressiveDetail from './immunosuppressiveDetail.vue'

export default {
  components: {
    immunosuppressiveDetail
  },
  data() {
    return {
      form: {
        pId: this.pId,
        thymicSurgeryTime: '',
        timeInterval: '',
        crisis: 1,
        crisisTimes: '',
        mgfa: '',
        sphericalMuscle: 0,
        preoperativeMedication: 0,
        bingQiu: 0,
        hormone: 0,
        plasma: 0,
        feiGong: 0,
        fcv: '',
        fev1: '',
        muscleWeakness: 0,
        surgicalApproach: 0,
        surgery: 0,
        scope: 0,
        surgicalDuration: '',
        loseWeight: '',
        muscleWeaknessAfter: 0,
        complication: '',
        pathology: '',
        name: [],
        immunosuppressive: [],
        medicationType: '1',
        preoperativeUseTime: '',
        dose: ''
      },
      titles: [
        {
          id: '1',
          title: '利妥昔单抗剂量（mg）'
        }, {
          id: '2',
          title: '醋酸泼尼松剂量（mg）'
        }, {
          id: '3',
          title: '甲泼尼龙剂量（mg）'
        }, {
          id: '4',
          title: '硫唑嘌呤剂量（mg）'
        }, {
          id: '5',
          title: '他克莫司剂量（mg）'
        }, {
          id: '6',
          title: '环孢素A剂量（mg）'
        }, {
          id: '7',
          title: '吗替麦考酚酯剂量（mg）'
        }, {
          id: '8',
          title: '甲氨蝶呤剂量（mg）'
        }, {
          id: '9',
          title: '环磷酰胺剂量（mg）'
        }
      ],
      immunosuppressiveValue: [],
      preoperativeMedicationValue: 0,
      crisisValue: 0,
      feiGongValue: 0,
      muscleWeaknessValue: 0,
      surgicalApproachValue: 0,
      pathologyValue: '',
      checkBoxValue: []
    }
  },
  inject: [
    'pId'
  ],
  methods: {
    onSubmit() {
      console.log('submit!')
    },
    handlePreoperativeMedication(v) {
      this.preoperativeMedicationValue = v
    },
    handleImmunosuppressive(v) {
      this.immunosuppressiveValue = v
    },
    isShow(key) {
      return this.form.immunosuppressive.indexOf(key) !== -1
    },
    handleCrisis(v) {
      this.crisisValue = v
    },
    handleFeiGong(v) {
      this.feiGongValue = v
    },
    handleMuscleWeakness(v) {
      this.muscleWeaknessValue = v
    },
    handleSurgicalApproach(v) {
      this.surgicalApproachValue = v
    },
    handlePathology(v) {
      this.pathologyValue = v
    },
    handleCheckBox(v) {
      this.checkBoxValue = v
    }
  }
}
</script>

<style>
.text-wrapper {
  white-space: pre-wrap;
}
</style>
